<!--内容开始-->
<section class="content">
    <div class="search">
        <form class="form-inline" action="" data-pjax>
            <a class="btn btn-flat btn-primary m_10" href="{:url('Auth/adminRule')}">显示全部</a>
            <input class="btn btn-flat btn-warning m_10 select_del" type="button" value="批量删除">
            <a class="btn btn-flat btn-success m_10 f_r" href='{:url('Auth/ruleAdd')}'><i
                class="fa fa-plus m-r-10"></i>添 加</a>
        </form>
    </div>
    <!--数据表开始-->
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <!-- /.box-header -->
                    <div class="box-body table-responsive no-padding">
                        <table class="table table-bordered table-hover">
                            <tr>
                                <th class="t_c"><input type="checkbox" id="check"></th>
                                <th class="t_c">编号</th>
                                <th class="t_c">图标</th>
                                <th>权限名称</th>
                                <th>控制器/方法</th>
                                <th class="t_c">是否验证权限</th>
                                <th class="t_c">菜单状态</th>
                                <th class="t_c">排序</th>
                                <th class="t_c">操作</th>
                            </tr>
                            {volist name='list' id='list' empty="$empty"}
                            <tr>
                                <td class="t_c"><input type="checkbox" name="key[]" value="{$list.id}"></td>
                                <td class="t_c">{$list.id}</td>
                                <td class="t_c"><i class="{$list.icon}"></i></td>
                                <td>{$list.ltitle}</td>
                                <td>{$list.name}</td>
                                <td class="t_c">
                                    {if $list.auth_open==1}
                                    <a class="auth_open state_ok" data-id="{$list.id}"><i
                                            class="fa fa-fw fa-check-square"></i></a>
                                    {else}
                                    <a class="auth_open state_no" data-id="{$list.id}"><i
                                            class="fa fa-fw fa-check-square"></i></a>
                                    {/if}
                                </td>
                                <td class="t_c">
                                    {if $list.status==1}
                                    <a class="state state_ok" data-id="{$list.id}"><i
                                            class="fa fa-fw fa-check-square"></i></a>
                                    {else}
                                    <a class="state state_no" data-id="{$list.id}"><i
                                            class="fa fa-fw fa-check-square"></i></a>
                                    {/if}
                                </td>
                                <td class="t_c">
                                    <input class="form-control input-sm w_40 m_auto changeSort" type="text"
                                           value="{$list.sort}" data-id="{$list.id}">
                                </td>
                                <td class="t_c">
                                    <a class="btn btn-flat btn-success btn-xs"
                                       href="{:url('Auth/ruleAdd',['id'=>$list.id])}">
                                        <i class="fa fa-plus"></i> 添加
                                    </a>
                                    <a class="btn btn-flat btn-info btn-xs"
                                       href="{:url('Auth/ruleEdit',['id'=>$list.id])}">
                                        <i class="fa fa-edit"></i> 编辑
                                    </a>
                                    <a class="btn btn-flat btn-warning btn-xs list_del" data-id="{$list.id}">
                                        <i class="fa fa-trash-o"></i> 删除
                                    </a>
                                </td>
                            </tr>
                            {/volist}
                        </table>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
        </div>
    </div>
    <!--数据表结束-->
</section>
<!--内容结束-->

<script>
    //删除
    $(".list_del").click(function () {
        var url = "{:url('Auth/ruleDel')}";
        var id = $(this).data("id");
        delOne(url, id)
    })

    //菜单状态
    $(".state").click(function () {
        var url = "{:url('Auth/ruleState')}";
        var id = $(this).data("id");
        changeState(url, id);
    })

    //是否验证权限
    $(".auth_open").click(function () {
        var url = "{:url('Auth/ruleOpen')}";
        var id = $(this).data("id");
        changeState(url, id);
    })

    //排序
    $(".changeSort").blur(function () {
        var url = "{:url('Auth/ruleSort')}";
        var id = $(this).data("id");
        var sort = $(this).val();
        changeSort(url, id, sort);
    })

    //批量删除
    $(".select_del").click(function () {
        var url = "{:url('Auth/ruleSelectDel')}";
        delSelect(url);
    })

</script>
